﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using ChatForum.Domain;

namespace ChatForum.DataContract
{
    [DataContract(Name = "Category")]
    public class CategoryDTO
    {
        public CategoryDTO(Category category)
		{
			if (category == null)
				throw new ArgumentNullException("category");

            this.Name = category.Name;
            this.Description = category.Description;
            this.AgeRequirement = category.AgeRequirement;
            this.ID = category.ID;
            this.CreatedDate = category.CreatedDate;
            this.CreatedBy = category.CreatedBy;
            this.ModifiedDate = category.ModifiedDate;
            this.ModifiedBy = category.ModifiedBy;
        }
        public Category Convert()
        {
            return new Category()
            {
                Name = this.Name,
                Description = this.Description,
                AgeRequirement = this.AgeRequirement,
                ID = this.ID,
                CreatedDate = this.CreatedDate,
                CreatedBy = this.CreatedBy,
                ModifiedDate = this.ModifiedDate,
                ModifiedBy = this.ModifiedBy,
            };
        }

        [DataMember]
        public string Name { get; set; }
        [DataMember]
        public string Description { get; set; }
        [DataMember]
        public int AgeRequirement { get; set; }


        [DataMember]
        public Guid ID { get; set; }
        [DataMember]
        public DateTime CreatedDate { get; set; }
        [DataMember]
        public string CreatedBy { get; set; }
        [DataMember]
        public DateTime ModifiedDate { get; set; }
        [DataMember]
        public string ModifiedBy { get; set; }
    }
}
